package demo3;

public class Test {
    public static void running(IRun iRun){
        iRun.run();
    }
    public static void eat(Animal animal){
        animal.eat();
    }
    public static void fly(IFly iFly){
        iFly.fly();
    }
    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }
    public static void main(String[] args) {
        Dog dog =new Dog("旺财",8);
        Bird bird= new Bird("啾啾",5);
        Fish fish= new Fish("小鱼儿",2);

        System.out.println("================");
        running(dog);
        running(bird);
        System.out.println("=================");
        fly(bird);
        System.out.println("=================");
        swimming(dog);
        swimming(fish);
        System.out.println("==================");

        //还可继续添加，有了接口实现这些就会变得非常的轻松
        Robot robot=new Robot();
        running(robot);

        System.out.println("===================");

        //继承接口的使用，和普通接口一致
        Forg forg = new Forg("王子",3);
        running(forg);
        swimming(forg);
    }
}
